package main

import "fmt"

func main() {

	var a = 1
	var b = &a

	println(b)

	var c *int = &a

	println(c)

	var p1 *int
	p1 = &a
	//*p1 = 100	//报错 panic: runtime error: invalid memory address or nil pointer dereference

	println(a)      //1
	*p1 = 100       //改变指针指向  变量的值
	println(a, *p1) //100

	//p1=100 //报错，因为p1是*int类型  100是int型

	var p2 = &p1 //多级指针

	println(p2, *p2, **p2) //多级指针

	var ia = 1
	var arraya = [...]int{1, 2, 3}
	fmt.Println(&ia)     //0xc00000a098
	fmt.Println(&arraya) //&[1 2 3]	//挺奇怪的

	fmt.Printf("%p", &arraya) //0xc0000b0090

}
